import { Carousel } from 'antd';
import { getbanner } from '../../api/goods'
import React, { Component } from 'react';
import './carousel.css'


export default class banners extends Component {
    state = {
        banners: []
    }

    render() {
        let banners = this.state.banners

        console.log(banners)


        return (
            <div className='ban'>
                <Carousel autoplay='true' dotPosition='right'>
                    {
                        banners.map(item => {
                            return (
                                <div key={item.id}>
                                    <h2>{item.content}</h2>
                                    <img src={item.url} alt="" />
                                </div>

                            )
                        })
                    }
                </Carousel>
            </div>
        )
    }

    componentDidMount() {
        getbanner().then(res => {
            this.setState({ banners: res.resultInfo.list })
        })
    }
}

